﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using WeChatIdentity.Constants;
using WeChatIdentity.Models;

namespace WeChatIdentity.EntityConfigurations
{
    public class RoleEntityTypeConfiguration
                : IEntityTypeConfiguration<Role>
    {
        public void Configure(EntityTypeBuilder<Role> builder)
        {

            builder.ToTable("Role", SchemaConstants.SchemaName);

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("Roleseq", SchemaConstants.SchemaName)
               .IsRequired();

            builder.Property(cb => cb.Name)
               .IsRequired(true);
            builder.Property(cb => cb.CreateTime)
               .IsRequired(true);
            builder.Property(cb => cb.UpdateTime)
               .IsRequired(false);
            
        }
    }
}
